package com.netease.framework;

import android.content.Context;
import android.graphics.Rect;
import android.text.Editable;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.EditText;

public class SplitTextEdit extends EditText
{
  private static char c = ';';
  private final boolean a = false;
  private final String b = "SplitTextEdit";
  private boolean d = false;
  private int e;
  private int f;

  public SplitTextEdit(Context paramContext)
  {
    super(paramContext);
  }

  public SplitTextEdit(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
  }

  public SplitTextEdit(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
  }

  private char a(CharSequence paramCharSequence)
  {
    int i = paramCharSequence.length();
    int k;
    int j;
    if (i > 0)
    {
      k = i - 1;
      j = paramCharSequence.charAt(k);
      if ((j == 32) || (j == 10) || (j == 13));
    }
    while (true)
    {
      return j;
      i = k;
      break;
      j = 0;
    }
  }

  private int a(int paramInt)
  {
    Editable localEditable = getText();
    if (paramInt >= localEditable.length())
      paramInt = -1 + localEditable.length();
    if (paramInt >= 0)
      if (localEditable.charAt(paramInt) != c);
    for (int i = paramInt + 1; ; i = 0)
    {
      return i;
      paramInt--;
      break;
    }
  }

  private boolean a()
  {
    Editable localEditable = getText();
    int i = getSelectionStart();
    if ((i == getSelectionEnd()) && (i > 0) && (localEditable.charAt(i - 1) == c))
    {
      int k = i - 1;
      if (k > 0)
        k = a(k - 1);
      setSelection(k, i);
    }
    for (int j = 1; ; j = 0)
      return j;
  }

  private int b(int paramInt)
  {
    Editable localEditable = getText();
    if (paramInt < 0)
      paramInt = 0;
    int i = localEditable.length();
    while (true)
    {
      if (paramInt < i)
      {
        if (localEditable.charAt(paramInt) != c)
          break label47;
        if (paramInt < i)
          i = paramInt + 1;
      }
      return i;
      label47: paramInt++;
    }
  }

  public void a(char paramChar)
  {
    c = paramChar;
  }

  protected void onFocusChanged(boolean paramBoolean, int paramInt, Rect paramRect)
  {
    this.d = true;
    super.onFocusChanged(paramBoolean, paramInt, paramRect);
    this.d = false;
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    boolean bool = true;
    this.d = bool;
    if ((paramInt == 67) && (bool == a()));
    while (true)
    {
      return bool;
      bool = super.onKeyDown(paramInt, paramKeyEvent);
    }
  }

  public boolean onKeyUp(int paramInt, KeyEvent paramKeyEvent)
  {
    this.d = false;
    return super.onKeyUp(paramInt, paramKeyEvent);
  }

  protected void onSelectionChanged(int paramInt1, int paramInt2)
  {
    super.onSelectionChanged(paramInt1, paramInt2);
    if ((paramInt1 == paramInt2) && (paramInt1 >= 0) && (paramInt2 >= 0) && (!this.d) && ((paramInt1 < this.e) || (paramInt2 > this.f) || (this.e == this.f)))
      setSelection(a(paramInt1), b(paramInt1));
    this.e = getSelectionStart();
    this.f = getSelectionEnd();
  }

  protected void onTextChanged(CharSequence paramCharSequence, int paramInt1, int paramInt2, int paramInt3)
  {
    super.onTextChanged(paramCharSequence, paramInt1, paramInt2, paramInt3);
    if ((a(paramCharSequence) != c) && (paramCharSequence.length() > 0))
    {
      append(Character.toString(c));
      this.d = true;
      setSelection(-1 + paramCharSequence.length());
      this.d = false;
    }
  }

  public boolean onTouchEvent(MotionEvent paramMotionEvent)
  {
    return super.onTouchEvent(paramMotionEvent);
  }

  public void onWindowFocusChanged(boolean paramBoolean)
  {
    if (!paramBoolean);
    for (boolean bool = true; ; bool = false)
    {
      this.d = bool;
      super.onWindowFocusChanged(paramBoolean);
      return;
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.framework.SplitTextEdit
 * JD-Core Version:    0.6.0
 */